// configureStore.js
import { persistStore, persistReducer } from 'redux-persist'
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import storage from 'redux-persist/lib/storage' // defaults to localStorage for web and AsyncStorage for react-native
 
import rootReducer from '@/reducers'
 
const persistConfig = {
  key: 'root',
  storage,
//   blacklist: ['navigation'] // navigation will not be persisted
// whitelist: ['navigation'] // only navigation will be persisted
}
 
const persistedReducer = persistReducer(persistConfig, rootReducer)
 
export default () => {
  let store = createStore(persistedReducer, applyMiddleware(thunk))
  let persistor = persistStore(store)
  return { store, persistor }
}